/**
* This file is part of OntoCompoFramework
*
* Copyright (C) 2011 -  Christian Brel
*
* @author   Main    Christian Brel
**/
package ontocompo.ui.screenmanagement;

import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;

import ontocompo.ui.selection.SelectionTools;

public class ScreenManager extends Observable implements Observer {

	private ArrayList<Screen> availabledScreens;
	
	public ScreenManager() {
		this.availabledScreens = new ArrayList<Screen>();
	}
	
	public ArrayList<Screen> getAvailabledScreens() {
		return this.availabledScreens;
	}
	
	public void addScreen(Screen s) {
		this.availabledScreens.add(s);
		this.setChanged();
		this.notifyObservers("newScreen");
	}

	@Override
	public void update(Observable arg0, Object arg1) {
		// TODO Auto-generated method stub
		if(arg0.getClass().isAssignableFrom(SelectionTools.class)) {
			if(arg1.getClass().isAssignableFrom(ScreenInfo.class)) {
				this.addScreen(new Screen(((ScreenInfo) arg1).getScreenName()));
			}
		}
	}
}
